<?php
require_once dirname(__FILE__) . '/../../php/ajaxupload.php';  
require_once dirname(__FILE__) . '/../../php/paths.cfg.php';
/**
 * Edit by krteczek for Texyla for WordPress Plugin
 * Load wordpress config && activate user permisions etc
 */
require_once(dirname(__FILE__) . '/../../../../../../../wp-config.php');
require_once(dirname(__FILE__) . '/../../../../../../../wp-admin/admin.php');

// settings for texyla-plugin, wordpress
$upl = new texylaAjaxFileUpload;
echo $upl->upload('texylaUploadHandler');

exit;

 
// povolené mime typy souborů.
// další získáte na http://www.mimetype.org/

$allowedFileExtensionAndMime = array(
	//nejprve je extense a k ní přiřazené mimetypy
	// images
	'jpg' => array('image/jpeg', 'image/pjpeg'),
	'jpeg' => array('image/jpeg', 'image/pjpeg'),
	'gif' => array('image/gif'),
	'png' => array('image/png'),
	'swf' => array('application/x-shockwave-flash'),
	
	// Compress
	'zip' => array('application/zip', 'application/x-zip', 'application/x-zip-compressed'),
	'gz' => array('application/x-tar-gz', 'application/x-gunzip', 'application/x-gzip'),
	'tgz' => array('application/x-tar-gz'),
	'tar' => array('application/x-tar'),
	'rar' => array('application/x-rar'),
	'arj' => array('application/x-arj-compressed'),
	'deb' =>  array('application/x-debian-package'),
	
	// documents
	'pdf' => array('application/pdf'),
	'rtf' => array('application/rtf'),
	'doc' => array('application/msword'),
    'xls' => array('application/excel'),
	'pot' => array('application/vnd.ms-powerpoint'),
	'pps' => array('application/vnd.ms-powerpoint'),
	'ppt' => array('application/vnd.ms-powerpoint'),
	'ppz' => array('application/vnd.ms-powerpoint'),
    'css' => array('text/css'),
    'html' => array('text/html'),
    'htm' => array('text/html'),
    'txt' => array('text/plain'),
	'asc' => array('text/plain'),
    'c' => array('text/plain'),
    'cc' => array('text/plain'),
    'f90' => array('text/plain'),
    'f' => array('text/plain'),
    'h' => array('text/plain'),
    'hh' => array('text/plain'),
    'm' => array('text/plain'),
    'rtx' => array('text/plain'),
    'rtf' => array('text/plain'),
    'sgm' => array('text/sgml'),
    'sgml' => array('text/sgml'),
    'tsv' => array('text/tab-separated-values'),
    'jad' => array('text/vnd.sun.j2me.app-descriptor'),
    'xml' => array('text/xml'),
    'etx' => array('text/x-setext'),

	// audio, video
	'mp2' => array('audio/mpeg', 'video/mpeg'),
	'mp3' => array('audio/mpeg'),
	'mpga' => array('audio/mpeg'),
	'mpeg' => array('video/mpeg'),
	'ogg' => array('application/ogg'),
	'ogm' => array('application/ogg'),
    'dl' => array('video/dl'),

    'fli' => array('video/fli'),
    'flv' => array('video/dl'),
    'gl' => array('video/gl'),
    'mpe' => array('video/mpeg'),
    'mpg' => array('video/mpeg'),
    'mov' => array('video/quicktime'),
    'qt' => array('video/quicktime'),
    'vivo' => array('video/vnd.vivo'),
    'fli' => array('video/x-fli'),
    'asf' => array('video/x-ms-asf'),
    'asx' => array('video/x-ms-asx'),
    'wmv' => array('video/x-wmv'),
    'wmx' => array('video/x-wmx'),
    'wvx' => array('video/x-wvx'),
    'avi' => array('video/x-msvideo'),
    'movie' => array('video/x-sgi-movie'),
    'vrm' => array('x-world/x-vrml'),
    'vrml' => array('x-world/x-vrml'),
	
	// Další položky si přidejte podle vlastních potřeb
   	'exe' => array('application/octet-stream'),
    'bin' => array('application/octet-stream'),
    'class' => array('application/octet-stream'),
	'dms' => array('application/octet-stream'),
	'exe' => array('application/octet-stream'),
	'lha' => array('application/octet-stream'),
	'lzh' => array('application/octet-stream'),

);	

// inicializace
$upl = new texylaAjaxFileUpload;

// Nastavení povolených extensí a Mimetypů souborů
$upl->setAllowExtension($allowedFileExtensionAndMime);

//nastavení cesty k adresáři pro nahrané soubory
$upl->setUploadDirName(TEXYLA_FILE_UPLOAD_DIR);

echo $upl->upload();

